#ifndef __FILE_CONFIG_H__
#define __FILE_CONFIG_H__

#ifdef __cplusplus
extern "C"
{
#endif

#include "list.h"

typedef struct fconf_stu fconf_t;
struct fconf_stu
{
    char file_name[128];
    List *plist;
    int (*parse)(fconf_t *p);
    int (*save)(fconf_t *p, char *file_name);
    int (*get)(fconf_t *p, char *key, char **value);
    int (*set)(fconf_t *p, char *key, char *value);
    int (*remove)(fconf_t *p, char *key);
    int (*add)(fconf_t *p, char *key, char *value);
    int (*get_size)(fconf_t *p);
    int (*print)(fconf_t *p);
};

/* Node data */
typedef struct {
    char *key;
    char *value;
} fconf_item_t;

int fconf_init(fconf_t *p, char *file_name);

#ifdef __cplusplus
}
#endif

#endif /* __FILE_CONFIG_H__ */